//
//  MineTableViewCell.swift
//  ManBetX
//
//  Created by Cocoa on 2020/4/13.
//  Copyright © 2020 Fullen. All rights reserved.
//

import UIKit

class MineTableViewCell: BaseTableViewCell {

    @IBOutlet weak var titleImageView: UIImageView!//图片
    @IBOutlet weak var titleLabel: UILabel!//标题
    @IBOutlet weak var infoLabel: UILabel!//详细信息
    @IBOutlet weak var bgView: UIView!//背景View
    
    var viewModel:MineViewModel?
    
    override func awakeFromNib() {
        super.awakeFromNib()
        self.selectedBackgroundView = UIView()
        self.selectedBackgroundView?.backgroundColor = UIColor.white
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)
    }
    
    override func configure(_ entity: Any) {
        
        self.viewModel = entity as? MineViewModel
        self.titleImageView.image = UIImage.init(named: self.viewModel!.imageString)
        self.titleLabel.text = self.viewModel!.titleString
        self.infoLabel.text = self.viewModel!.infoString
        
        self.infoLabel.isHidden = self.viewModel!.caseType == .mineWallet ? false : true ;
    }
    
    func setRectCorner() {
        // 处理圆角
        switch viewModel!.rectCornerType {
            case .rectCorner(let rectCorner):
                self.bgView.setCornerWithCorners([rectCorner], cornerRadii: CGSize.init(width: 8, height: 8))
            case .noCorner: break// 不切圆角
        }
    }
}
